package com.example.yk_lx.addGroup;

import androidx.lifecycle.MutableLiveData;

import com.example.yk_lx.baseMVVM.BaseRepo;
import com.hyphenate.EMValueCallBack;
import com.hyphenate.chat.EMGroup;
import com.hyphenate.chat.EMGroupOptions;

public class AddGroupRepo extends BaseRepo {
    public void addGroup(String groupname, String desc, String[] numbers,
                         String reason, EMGroupOptions options, MutableLiveData<String> success,MutableLiveData<String> fail){
        client.groupManager().asyncCreateGroup(groupname, desc, numbers, reason, options, new EMValueCallBack<EMGroup>() {
            @Override
            public void onSuccess(EMGroup value) {
                success.postValue("创建群组成功");
            }

            @Override
            public void onError(int error, String errorMsg) {
                fail.postValue("创建群组失败："+errorMsg);
            }
        });
    }
}
